package com.cwx.dao;

import com.cwx.pojo.Type;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface TypeRepository extends JpaRepository<Type,Long> {

    //根据名字查找Type
    Type findByName(String name);

    //根据分类中对应的博客数量来排序 查询出指定的前几个用户  传过来一个分页的参数
    @Query("select t from Type t")
    List<Type> findTop(Pageable pageable);


}
